/*
 * @Author: szx
 * @Date: 2022-03-04 13:51:22
 * @LastEditTime: 2022-03-04 13:55:03
 * @Description:
 * @FilePath: \leetcode\400-499\404\404_2.js
 */
/**
 * @param {TreeNode} root
 * @return {number}
 */
var sumOfLeftLeaves = function (root) {
    if (!root) return 0;
    if (root.left && !root.left.left && !root.left.right) {
        return root.left.val + sumOfLeftLeaves(root.right);
    }
    return sumOfLeftLeaves(root.left) + sumOfLeftLeaves(root.right);
};
